const { defineConfig } = require("@vue/cli-service");
const path = require("path");
const isProd = process.argv.toString().includes("build");

console.log("是否执行打包配置?", isProd);

module.exports = defineConfig({
  devServer: {
    // 取消错误遮罩层
    client: {
      overlay: false,
    },
    proxy: {
      "/api": {
        target: "http://192.168.168.001:8080/gantt/api/v1",
        changeOrigin: true,
        pathRewrite: {
          "^/api": "",
        },
      },
    },
  },
  transpileDependencies: true,
  productionSourceMap: false, // 禁用生成source map
  configureWebpack: (config) => {
    if (process.env.NODE_ENV === 'production') {
      config.optimization.minimize = true; // 在生产环境下压缩JS代码
      
    }
  },
  configureWebpack: {
     //关闭 webpack 的性能提示
     performance: {
        hints:false
    },
    resolve: {
      alias: {
        "@": path.resolve(__dirname, "src"), // 这里添加别名配置，@ 表示src目录的绝对路径
        // 可以添加更多的别名
        // 'components': path.resolve(__dirname, 'src/components'),
        // 'views': path.resolve(__dirname, 'src/views'),
      },
    },
  },
});
